<template>
	<view class="video">
		<view class="container flex_r_between">
			<view class="list" v-for="(item,index) in list" :key="index" @click="$native.toPublish(item)">
				<view class="image">
					<image v-show="item.goods_image.length" :src="item.goods_image[0]" mode="aspectFill"></image>
				</view>
				<view class="text">
					<view class="name hidden">{{item.name || ''}}</view>
					<view class="price flex_r_between">
						<text>¥{{Number(item.price).toFixed(0)}}</text>
						<view>发布</view>
					</view>
				</view>
			</view>
		</view>
		
		<empty v-if="!list.length"></empty>
		
		<view class="loading" v-if="list.length">
			<u-loadmore :status="status" />
		</view>
	</view>
</template>

<script>
	import empty from '@/compentents/empty/empty.vue';
	export default {
		name: 'videoList',
		props: {

		},
		components: {
			empty
		},
		data() {
			return {
				list: [],
				page: 1,
				total: 0,
				status: 'loading',
			}
		},
		methods: {
			getList() {
				this.$get('/store_goods/getStoreGoodsList', {
					page: this.page,
					limit: 10,
					status: 2
				}).then(res => {
					this.status = 'loading'
					this.total = res.data.total;
					this.list.push(...res.data.data);
					if (this.total <= this.list.length) {
						this.status = 'nomore'
					}
				});
			},
			
			getMore(){
				if(this.total > this.list.length){
					this.page++;
					this.getList();
				}
			}
		},
		
		created() {
			this.getList();
		},
	}
</script>

<style lang="less" scoped>
	.container {
		flex-wrap: wrap;
		padding: 24rpx 28rpx 0;
	}

	.list {
		width: 336rpx;
		background: #FFFFFF;
		border-radius: 24rpx;
		padding-bottom: 18rpx;
		margin-bottom: 24rpx;

		.image {
			width: 336rpx;
			height: 336rpx;
			background: #D8D8D8;
			border-radius: 24rpx;
			overflow: hidden;

			image {
				width: 336rpx;
				height: 336rpx;
			}
		}

		.text {
			padding: 0 24rpx;
			margin-top: 24rpx;

			.name {
				font-size: 28rpx;
				color: #131313;
				margin-bottom: 10rpx;
			}

			.price {
				text {
					font-weight: 600;
					font-size: 36rpx;
					color: #FD2A53;
				}

				view {
					width: 88rpx;
					height: 40rpx;
					background: #FD2A53;
					border-radius: 20rpx;
					font-size: 28rpx;
					color: #FFFFFF;
					line-height: 40rpx;
					text-align: center;
				}
			}
		}

	}
	
	.loading {
		padding-bottom: 20rpx;
	}
	
</style>